//
//  NoticeFrame.m
//  智慧小区
//
//  Created by lab603 on 15/7/7.
//  Copyright (c) 2015年 Dreamsoul. All rights reserved.
//

#import "NoticeFrame.h"
#import "Notice.h"
#define Top_Padding 10
#define Left_Padding 20
#define statusIconWH 30
#define isReadViewWH 25

@implementation NoticeFrame
-(void)setNotice:(Notice *)notice{
    _notice = notice;
    //紧急图标的Frame
    CGFloat urgencyViewX = Left_Padding;
    CGFloat urgencyViewY = Left_Padding;
    CGSize urgencyViewSize = (CGSize){statusIconWH,statusIconWH};
    _urgencyViewF = (CGRect){{urgencyViewX,urgencyViewY},urgencyViewSize};
    //标题Label
    CGFloat titleLabelX = CGRectGetMaxX(_urgencyViewF)+Top_Padding;
    CGFloat titleLabelY = urgencyViewY+5;
    CGSize titleLabelSize = (CGSize){ScreenWidth - titleLabelX - 2*Left_Padding,20};
    _titleLabelF = (CGRect){{titleLabelX,titleLabelY},titleLabelSize};
    //时间Label
    CGFloat timeLabelX = urgencyViewX;
    CGFloat timeLabelY = CGRectGetMaxY(_titleLabelF)+Left_Padding;
    CGSize timeLabelSize = [notice.time sizeWithFont:[UIFont systemFontOfSize:13.0]];
    _timeLabelF =(CGRect){{timeLabelX,timeLabelY},timeLabelSize};
    //cell的高度
    _cellHeight = CGRectGetMaxY(_timeLabelF)+Top_Padding;
    //是否已阅读
    CGSize isReadViewSize = (CGSize){isReadViewWH,isReadViewWH};
    CGFloat isReadViewX = ScreenWidth - Top_Padding - isReadViewWH;
    CGFloat isReadViewY = (_cellHeight - isReadViewWH)*0.5;
    _isReadViewF = (CGRect){{isReadViewX,isReadViewY},isReadViewSize};
}
@end
